<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Object.create</title>
</head>

<body>
  <script>
    let o = Object.create(Object.prototype)
    console.log(o);

    let o1 = Object.create({ x: 1, y: 2 })
    o1 = Object.create({ x: 3, y: 2 })
    o1.x = 3
    console.log(o1);


    let o2 = { x: 'wct' }// 写在构造函数里
    let o3 = Object.create(o2)//写在原型函数里 o3继承原型  防止意外修改
    console.log(o3);
    console.log(o2);

    let o4 = new Object()
    console.log(o4);

    function addstock(stock, name, shares) {
      stock[name] = shares
    }
    a = {}
    addstock(a, 'wcy', 50)
    console.log(a);
  </script>
</body>

</html>